<?php
namespace App\Repositories;

use App\Models\College;
use Exception;

class CollegeRepository
{
    public function getList($filter = [])
    {
        $cache_key = "cache_college_list_" . md5(implode("_",array_values($filter)));
        $res = \Cache::get($cache_key);
        if(empty($res)){
            $res =  College::query()
                ->where($filter)
                ->orderBy("id", "asc")
                ->orderBy("sort", "desc")
                ->get(['id','title'])
                ->toArray();
            \Cache::set($cache_key, $res);
        }
        return $res;
    }
}
